#!/bin/bash

## L2 params
IFACE=ath0
MODE=monitor
FREQ=2.412GHz
ESSID=mine
RATE=1Mb

## L3 params
MYIP=10.1.2.2
MYMASK=255.255.255.0
MYBCAST=10.1.2.255

## ARP params
IPDST=10.1.2.1
MACDST=00:00:00:00:00:00

## Script
wlanconfig $IFACE destroy 
wlanconfig $IFACE create wlandev wifi0 wlanmode $MODE 
iwconfig $IFACE freq $FREQ essid $ESSID rate $RATE
ifconfig $IFACE down
ifconfig $IFACE $MYIP netmask $MYMASK up
#arp -d $IPDST
#arp -s $IPDST $MACDST

## Test
echo -ne "\n\n>>> L2 parameters:\n"
iwconfig ath0
echo -ne "\n\n>>> L3 parameters:\n"
ifconfig ath0
#echo -ne "\n\n>>> ARP table:\n"
#arp -e
